import json

from curl_cffi import requests

from util.headers import get_header


url = "https://odin.sohu.com/odin/api/blockdata"
data = {
    "pvId": "1761914032885_LeialIt",
    "pageId": "1761914034042_1761913799788odi_W4x",
    "mainContent": {
        "productType": "13",
        "productId": "950",
        "secureScore": "50",
        "categoryId": "41",
        "adTags": "20000077",
        "authorId": 121135924,
    },
    "resourceList": [
        {
            "tplCompKey": "TPLSearch_1_0_pc",
            "content": {
                "requestId": "1761914031150l8ERnQq_950",
                "productId": 268,
                "productType": 14,
                "page": 3,
                "size": 20,
                "pro": "0,1",
                "feedType": "XTOPIC_SYNTHETICAL",
            },
        }
    ],
}
res = requests.post(
    url,
    data=json.dumps(data),
    headers=get_header("https://www.sohu.com/xchannel/TURBd01EQXdPVFV3?"),
    impersonate="chrome119",
)
# print(res.json())
for item in res.json().get("data").get("TPLSearch_1_0_pc").get("list"):
    print(item.get("title"))
